package com.adobesamples.state
{
  import com.adobesamples.state.vo.ConfigurationItem;

  import flash.events.Event;
  import flash.events.EventDispatcher;

  public class ModelState extends EventDispatcher
  {
    private var _currentConfiguration: ConfigurationItem;

    public function ModelState()
    {
      _currentConfiguration = new ConfigurationItem();
    }

    [Bindable(event="configurationChanged")]
    public function get currentConfiguration(): ConfigurationItem {
      return _currentConfiguration;
    }

    private function setCurrentConfiguration(configuration: ConfigurationItem): void {
      _currentConfiguration = configuration;
      this.dispatchEvent(new Event("configurationChanged"));
    }

    model function resetConfiguration(): void {
      var configuration: ConfigurationItem = new ConfigurationItem();
      this.setCurrentConfiguration(configuration);
    }
  }
}